//导入express
const express = require('express');

//创建路由模块
const router = express.Router();

//导入验证数据的中间件
const expressJoi = require('@escook/express-joi');
//导入需要验证的对象
const { update_userinfo_schema, update_password_schema,update_avatar_schema } = require('../schema/user')


//导入路由处理函数模块
const userinfo_handler = require('../router_handler/userinfo');
//获取用户信息路由
router.get('/userinfo',userinfo_handler.getUserInfo);

// 更新用户基本信息路由
router.post('/userinfo',expressJoi(update_userinfo_schema), userinfo_handler.updateUserInfo);


//重置密码路由
router.post('/updatepwd',expressJoi(update_password_schema), userinfo_handler.updatePassword)


//更换头像的路由
router.post('/update/avatar',expressJoi(update_avatar_schema), userinfo_handler.updateAvatar)

//向外共享路由
module.exports = router;